package pkg

import (
	"2302a/audio_podcast/config"
	"encoding/json"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
)

type TextClient struct {
	ConclusionType uint64 `json:"conclusionType"`
}

func Sensitive(message string) bool {
	client := censor.NewClient(config.AppConf.BaiDuYun.APIKey, config.AppConf.BaiDuYun.SecretKey)
	var resp TextClient
	res := client.TextCensor(message)
	_ = json.Unmarshal([]byte(res), &resp)
	if resp.ConclusionType == 1 {
		return true
	}
	return false

}
